//
//  UIImageView+WLWebImage.m
//  LookNovel
//
//  Created by chuangqi on 2021/3/9.
//  Copyright © 2021 cq Co.,ltd. All rights reserved.
//

#import "UIImageView+WLWebImage.h"
@implementation UIImageView (WLWebImage)

- (void)wl_setImage:(NSString *)url {
    [self wl_setImage:url placeholdImage:[UIImage imageNamed:@"bitmap_image"]];
}
- (void)wl_setImage:(NSString *)url placeholdImage:(UIImage *)placeholdImage {
    if (kStringIsEmpty(url)){
        self.image = placeholdImage ? placeholdImage : [UIImage imageNamed:@"bitmap_image"];
        return;
    }
    if (!url || url.length <= 0) {
        self.image = placeholdImage ? placeholdImage : [UIImage imageNamed:@"bitmap_image"];
        return;
    }
    [self sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:placeholdImage options:SDWebImageAllowInvalidSSLCertificates completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        if (error) {
            self.image = placeholdImage ? placeholdImage : [UIImage imageNamed:@"bitmap_image"];
            return;
        }
        self.image = image;
    }];
}

@end
